package leetcode.D200.T141;

import util.ListNode;

class Solution {
    public boolean hasCycle(ListNode head) {
        ListNode fast = head, slow = head;
        while(fast != null) {
            fast = fast.next;
            if(fast == null) return false;
            if(fast == slow) return true;
            fast = fast.next;
            if(fast == slow) return true;
            slow = slow.next;
        }
        return false;
    }
}
